﻿using Microsoft.AspNetCore.SignalR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace StudentCouncil.API
{
    public class ChatHub:Hub
    {
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="message"></param>
        /// <returns></returns>

        public  Task SendMsg(string userName, string message)
        {
            return Clients.All.SendAsync("Show", userName, message);
        }

        //public async Task SendMessage(string userName, string message)
        //{
        //    await Clients.All.SendAsync("SendMessage", userName, message);
        //}
        //public override Task OnConnectedAsync()
        //{
        //    return base.OnConnectedAsync();
        //}
        //public override Task OnDisconnectedAsync(Exception exception)
        //{
        //    return base.OnDisconnectedAsync(exception);
        //}
    }
}
